package com.hengpeng.itfin.service;

import java.util.Date;

import com.hengpeng.common.exception.ServiceResult;
import com.hengpeng.itfinbase.message.RequestMessage;
import com.hengpeng.itfinbase.message.ResponseMessage;
import com.hengpeng.itfinbase.message.partner.LoansRequest;
import com.hengpeng.itfinbase.message.partner.LoansResponse;
import com.hengpeng.itfinbase.message.partner.ReconciliationResponseMsg;
import com.hengpeng.itfinbase.message.partner.UsrUnFreezeRequest;
import com.hengpeng.itfinbase.message.partner.UsrUnFreezeResponse;
import com.hengpeng.itfinbase.persist.BorrowInfo;
import com.hengpeng.itfinbase.persist.InvestInfo;

public interface BorrowService
{
	/**
	 * <pre>
	 * 修改状态改为募集中
	 * </pre>
	 */
	public void borrowStartRaise();

	/**
	 * <pre>
	 * 标的募集结束
	 * </pre>
	 */
	public void borrowEndRaise();

	/**
	 * <pre>
	 * 逾期标的维护
	 * </pre>
	 */
	public void overdure();

	/**
	 * <pre>
	 * 标的信息录入
	 * </pre>
	 * @param request
	 */
	public ResponseMessage addBidInfo(RequestMessage request);

	/**
	 * <pre>
	 * 标的录入定时任务
	 * </pre>
	 */
	public void addBidInfoList();

	/**
	 * <pre>
	 * 放款
	 * </pre>
	 * @param id
	 */
	public ServiceResult<Boolean> loans(LoansRequest request);

	/**
	 * <pre>
	 * 生成收款计划
	 * </pre>
	 * @param borrow
	 */
	public void makeReceivePlans(BorrowInfo borrow);

	/**
	 * <pre>
	 * 生成还款计划
	 * </pre>
	 * @param borrow
	 */
	public void makeRepayPlans(Long id);

	/**
	 * <pre>
	 * 投资放款操作
	 * </pre>
	 * @param borrow
	 * @param invest
	 */
	public LoansRequest loansInvest(BorrowInfo borrow, InvestInfo invest);

	/**
	 * <pre>
	 * 标的放款
	 * </pre>
	 * @param borrow
	 */
	public void loansParnter(BorrowInfo borrow);

	/**
	 * <pre>
	 * 放款结果处理
	 * </pre>
	 * @return
	 */
	public ServiceResult<String> loansResponse(LoansResponse loanResponse);

	/**
	 * <pre>
	 * 流标撤销标的
	 * </pre>
	 * @param request
	 * @return
	 */
	public ServiceResult<Boolean> loss(UsrUnFreezeRequest request);

	/**
	 * <pre>
	 * 流标解冻资金
	 * </pre>
	 * @param invest
	 * @param single 是否单个撤销
	 * @return
	 */
	public UsrUnFreezeRequest loss(InvestInfo invest);

	/**
	 * <pre>
	 * 撤标通知的响应
	 * </pre>
	 * @param response
	 * @return
	 */
	public ServiceResult<String> lossResponse(UsrUnFreezeResponse response);

	/**
	 * <pre>
	 * 标的放款成功或者流标成功状态维护
	 * </pre>
	 */
	public void borrowLoanEnd();

	/**
	 * <pre>
	 * 放款对账
	 * </pre>
	 * @param pageNum
	 * @param pageSize
	 * @param beginDate
	 * @param endDate
	 */
	public void loansReconciliation(Integer pageNum, Integer pageSize, Date beginDate, Date endDate);

	/**
	 * <pre>
	 * 执行放款对账
	 * </pre>
	 * @param pageNum
	 * @param pageSize
	 * @param beginDate
	 * @param endDate
	 * @return
	 */
	public ReconciliationResponseMsg doLoansReconciliation(Integer pageNum, Integer pageSize, Date beginDate,
			Date endDate);

	public void requireNewLoanEnd(BorrowInfo borrowInfo);

	public void requireNewLossEnd(BorrowInfo borrowInfo);

	/**
	 * <pre>
	 * 流标结束
	 * </pre>
	 */
	public void borrowLossEnd();
}
